<div class="page-group">
	<div class="page" data-page="book_kind">
		<header class="bar bar-nav">
			<a onclick="window.history.go(-1);" class="icon" style="width: 40%">
				<img src="__PUBLIC__/img/iconfont_back@2x.png" class="back_img">
			</a>
		</header>
		<div class="content">
			<volist name="d" id="v">
				<if condition="$v.is_apprised eq 1">
					<div style="padding: 10px;background: #FFF;border-bottom:1px solid #F5F5F5">
						<div style="">
							<img src="{$v.b_logo}" style="width:100%;">
						</div>
						<div style="width: 100%;text-align: center;">
							<input class="color_opbac_button_com" type="button" value="已评价" style="width: 150px;padding: 5px">
						</div>
					</div>
				<else/>
					<form id="judge{$v.order_has_book_id}"  action="{:U('Comment/post')}">
						<div style="padding: 10px;background: #FFF;border-bottom:1px solid #F5F5F5">
							<div style="">
								<img src="{$v.b_logo}" style="width:100%;">
							</div>
							<div style="width: 100%">
								<textarea id="comContent{$v.order_has_book_id}" name="comcontent" placeholder="输入评价内容"  style="width: 90%;border:none;height:120px;text-indent: 10px"></textarea>
							</div>
						</div>
						<div style="padding:10px;background: #FFF">
							描述相符<div class="jRate jRate-{$v.order_has_book_id}" style="float:right" data-id="{$v.order_has_book_id}"></div>
						</div>
						<div style="padding:10px;background: #FFF">
							发货速度<div class="RRate RRate-{$v.order_has_book_id}" style="float:right" data-id="{$v.order_has_book_id}"></div>
						</div>
						<div style="padding:10px;background: #FFF">
							服务态度<div class="ERate ERate-{$v.order_has_book_id}" style="float:right" data-id="{$v.order_has_book_id}"></div>
						</div>
						<input type="hidden" id="describe-{$v.order_has_book_id}" name="describe"  value="0">
						<input type="hidden" id="speed_trans-{$v.order_has_book_id}" name="speed_trans" value="0">
						<input type="hidden" id="attitude_service-{$v.order_has_book_id}" name="attitude_service" value="0">
						<input type="hidden" name="order_has_book_id" value="{$v.order_has_book_id}">
						<input type="hidden" name="book_id" value="{$v.book_id}">
						<input type="hidden" name="order_id" value="{$v.order_id}">
					</form>
					<div style="text-align: center;margin-bottom: 40px;margin-top: 10px;">
						<input type="button" value="提交" style="width: 150px;padding: 5px" onclick="check('{$v.order_has_book_id}')">
					</div>
				</if>
			</volist>
		</div>
	</div>
</div>

<script type='text/javascript' src='__PUBLIC__/js/zepto.min.js' charset='utf-8'></script>
<script type='text/javascript' src='__PUBLIC__/js/sm.min.js' charset='utf-8'></script>
<script type='text/javascript' src='__PUBLIC__/js/sm-extend.min.js' charset='utf-8'></script>
<script type='text/javascript' src='__PUBLIC__/js/jquery-1.9.1.min.js' charset='utf-8'></script>
<script type='text/javascript' src='__PUBLIC__/js/jquery.raty.js' charset='utf-8'></script>
<script>
	$.fn.raty.defaults.path = '__PUBLIC__/img';
	$(function() {
  			$('.jRate').raty({
  				click: function(score, evt) {
					var id=$(this).data("id");
  		    		$("#describe-"+id).val(score);
  		 	 }
  		});
	})
	$(function() {
  			$('.RRate').raty({
  				click: function(score, evt) {
					var id=$(this).data("id");
					$("#speed_trans-"+id).val(score);
  		 	 }
  		});
	})
	$(function() {
  			$('.ERate').raty({
  				click: function(score, evt) {
  					var id=$(this).data("id");
					$("#attitude_service-"+id).val(score);
  		 	 }
  		});
	})
	
	function check(orderbook_id){
		if($("#comContent"+orderbook_id).val()==""||$("#comContent"+orderbook_id).val()==null){
			alert("你没有填写评论内容")
		}
		else if($(".describe-"+orderbook_id).val()==0||$(".speed_trans-"+orderbook_id)==0||$(".attitude_service-"+orderbook_id)==0){
			alert("您没有评论完全")
		}else{
//			$("#judge"+orderbook_id).submit();

			$.get("{:U('Comment/post')}",$("#judge"+orderbook_id).serialize(),function(data){
				if(data>0){
					alert("评论成功，获得"+data+"积分");
					location.reload();
				}else{
					alert("评论失败"+data);
					location.reload();
				}
		});
		}
	}
</script>